import re
from common.response import JsonResponse
from rest_framework.decorators import api_view
from common.constant import CODE_PARAMETER_ERROR, MSG_PARAMETER_ERROR, CODE_BUSSINESS_ERROR
from .consumers import notify_device_install


@api_view(['POST'])
def notify_install(request):
    try:
        deviceList = request.data['deviceList']
        for id in deviceList:
            notify_device_install(id)
        return JsonResponse(data=None)
    except Exception:
        return JsonResponse(data=None, code=CODE_PARAMETER_ERROR, message=MSG_PARAMETER_ERROR)



